package com.ghck.shop.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

import com.ghck.shop.dao.provider.TiXianMapperProvider;
import com.ghck.shop.model.TiXian;

public interface TiXianMapper {

	@Insert("insert into t_tixian"
			+ "(user_id,name,card_no,bank_id,bank_name,amount,status,create_time,update_time)"
			+ "values"
			+ "(#{userId},#{name},#{cardNo},#{bankId},#{bankName},#{amount},0,now(),now())")
	public Integer saveTiXian(TiXian tiXian);
	
	@Select("select * from t_tixian where id=#{id} and user_id=#{userId}")
	public TiXian findTiXianByIdAndUserId(@Param("id")Integer id,@Param("userId")Integer userId);
	@Select("select * from t_tixian where id=#{id}")
	public TiXian findTiXianById(@Param("id")Integer id);
	
	@Update("update t_tixian set status=1 where id=#{id}")
	public Integer updateTiXianComplete(Integer id);
	
	@SelectProvider(type=TiXianMapperProvider.class,method="adminTixianlist")
	public List<TiXian> adminTixianlist(@Param("tixian")TiXian tiXian, @Param("start")Integer start,@Param("limit")Integer limit);
	
	@SelectProvider(type=TiXianMapperProvider.class,method="countAdminTixianlist")
	public Integer countAdminTixianlist(TiXian tiXian);
}
